home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 104 / MacAddict_104_2005-04.iso / Software / Internet & Communication / WordPress 1.2.2 freeware.dmg / wordpress / wp-includes / links.php < prev    next >
Encoding:
PHP Script  |  2004-10-06  |  22.0 KB  |  580 lines

  1. <?php
  2.  
  3. /** function get_linksbyname()
  4.  ** Gets the links associated with category 'cat_name'.
  5.  ** Parameters:
  6.  **   cat_name (default 'noname')  - The category name to use. If no
  7.  **     match is found uses all
  8.  **   before (default '')  - the html to output before the link
  9.  **   after (default '<br />')  - the html to output after the link
  10.  **   between (default ' ')  - the html to output between the link/image
  11.  **     and it's description. Not used if no image or show_images == true
  12.  **   show_images (default true) - whether to show images (if defined).
  13.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  14.  **     'url', 'description' or 'rating'. Or maybe owner. If you start the
  15.  **     name with an underscore the order will be reversed.
  16.  **     You can also specify 'rand' as the order which will return links in a
  17.  **     random order.
  18.  **   show_description (default true) - whether to show the description if
  19.  **     show_images=false/not defined
  20.  **   show_rating (default false) - show rating stars/chars
  21.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  22.  **     are shown.
  23.  **   show_updated (default 0) - whether to show last updated timestamp
  24.  */
  25. function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
  26.                          $between = " ", $show_images = true, $orderby = 'id',
  27.                          $show_description = true, $show_rating = false,
  28.                          $limit = -1, $show_updated = 0) {
  29.     global $tablelinkcategories, $wpdb;
  30.     $cat_id = -1;
  31.     $results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
  32.     if ($results) {
  33.         foreach ($results as $result) {
  34.             $cat_id = $result->cat_id;
  35.         }
  36.     }
  37.     get_links($cat_id, $before, $after, $between, $show_images, $orderby,
  38.               $show_description, $show_rating, $limit, $show_updated);
  39. }
  40.  
  41. function bool_from_yn($yn) {
  42.     if ($yn == 'Y') return 1;
  43.     return 0;
  44. }
  45.  
  46. /** function wp_get_linksbyname()
  47.  ** Gets the links associated with the named category.
  48.  ** Parameters:
  49.  **   category (no default)  - The category to use.
  50.  **/
  51. function wp_get_linksbyname($category) {
  52.     global $wpdb, $tablelinkcategories;
  53.  
  54.     $cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
  55.          . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
  56.          . " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_name='$category'");
  57.     if ($cat) {
  58.         if ($cat->sort_desc == 'Y') {
  59.             $cat->sort_order = '_'.$cat->sort_order;
  60.         }
  61.         get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
  62.                   $cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
  63.                    bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
  64.                    $cat->list_limit, bool_from_yn($cat->show_updated));
  65.     }
  66. } // end wp_get_linksbyname
  67.  
  68. /** function wp_get_links()
  69.  ** Gets the links associated with category n.
  70.  ** Parameters:
  71.  **   category (no default)  - The category to use.
  72.  **/
  73. function wp_get_links($category) {
  74.     global $wpdb, $tablelinkcategories;
  75.  
  76.     $cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
  77.          . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
  78.          . " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$category");
  79.     if ($cat) {
  80.         if ($cat->sort_desc == 'Y') {
  81.             $cat->sort_order = '_'.$cat->sort_order;
  82.         }
  83.         get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all,
  84.                   $cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order,
  85.                    bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating),
  86.                    $cat->list_limit, bool_from_yn($cat->show_updated));
  87.     }
  88. } // end wp_get_links
  89.  
  90. /** function get_links()
  91.  ** Gets the links associated with category n.
  92.  ** Parameters:
  93.  **   category (default -1)  - The category to use. If no category supplied
  94.  **      uses all
  95.  **   before (default '')  - the html to output before the link
  96.  **   after (default '<br />')  - the html to output after the link
  97.  **   between (default ' ')  - the html to output between the link/image
  98.  **     and it's description. Not used if no image or show_images == true
  99.  **   show_images (default true) - whether to show images (if defined).
  100.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  101.  **     'url', 'description', or 'rating'. Or maybe owner. If you start the
  102.  **     name with an underscore the order will be reversed.
  103.  **     You can also specify 'rand' as the order which will return links in a
  104.  **     random order.
  105.  **   show_description (default true) - whether to show the description if
  106.  **    show_images=false/not defined .
  107.  **   show_rating (default false) - show rating stars/chars
  108.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  109.  **     are shown.
  110.  **   show_updated (default 0) - whether to show last updated timestamp
  111.  */
  112. function get_links($category = -1, $before = '', $after = '<br />',
  113.                    $between = ' ', $show_images = true, $orderby = 'name',
  114.                    $show_description = true, $show_rating = false,
  115.                    $limit = -1, $show_updated = 1, $echo = true) {
  116.  
  117.     global $tablelinks, $wpdb;
  118.  
  119.     $direction = ' ASC';
  120.     $category_query = "";
  121.     if ($category != -1) {
  122.         $category_query = " AND link_category = $category ";
  123.     }
  124.     if (get_settings('links_recently_updated_time')) {
  125.         $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL ".get_settings('links_recently_updated_time')." MINUTE) >= NOW(), 1,0) as recently_updated ";
  126.     } else {
  127.         $recently_updated_test = '';
  128.     }
  129.     if ($show_updated) {
  130.         $get_updated = ", UNIX_TIMESTAMP(link_updated) AS link_updated_f ";
  131.     }
  132.  
  133.     $orderby=strtolower($orderby);
  134.     if ($orderby == '')
  135.         $orderby = 'id';
  136.     if (substr($orderby,0,1) == '_') {
  137.         $direction = ' DESC';
  138.         $orderby = substr($orderby,1);
  139.     }
  140.  
  141.     switch($orderby) {
  142.         case 'length':
  143.         $length = ",CHAR_LENGTH(link_name) AS length";
  144.         break;
  145.         case 'rand':
  146.             $orderby = 'rand()';
  147.             break;
  148.         default:
  149.             $orderby = " link_" . $orderby;
  150.     }
  151.  
  152.     if (!isset($length)) {
  153.         $length = "";
  154.     }
  155.  
  156.     $sql = "SELECT link_url, link_name, link_image, link_target,
  157.             link_description, link_rating, link_rel $length $recently_updated_test $get_updated
  158.             FROM $tablelinks
  159.             WHERE link_visible = 'Y' " .
  160.            $category_query;
  161.     $sql .= ' ORDER BY ' . $orderby;
  162.     $sql .= $direction;
  163.     /* The next 2 lines implement LIMIT TO processing */
  164.     if ($limit != -1)
  165.         $sql .= " LIMIT $limit";
  166.     //echo $sql;
  167.     $results = $wpdb->get_results($sql);
  168.     if (!$results) {
  169.         return;
  170.     }
  171.     foreach ($results as $row) {
  172.         if (!isset($row->recently_updated)) $row->recently_updated = false;
  173.         echo($before);
  174.         if ($show_updated && $row->recently_updated) {
  175.             echo get_settings('links_recently_updated_prepend');
  176.         }
  177.         $the_link = '#';
  178.         if (($row->link_url != null) && ($row->link_url != '')) {
  179.             $the_link = htmlspecialchars(stripslashes($row->link_url));
  180.         }
  181.         $rel = stripslashes($row->link_rel);
  182.         if ($rel != '') {
  183.             $rel = " rel='$rel'";
  184.         }
  185.         $desc = htmlspecialchars(stripslashes($row->link_description), ENT_QUOTES);
  186.         $name = htmlspecialchars(stripslashes($row->link_name), ENT_QUOTES);
  187.  
  188.         $title = $desc;
  189.  
  190.         if ($show_updated) {
  191.            if (substr($row->link_updated_f,0,2) != '00') {
  192.                 $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) .')';
  193.             }
  194.         }
  195.  
  196.         if ('' != $title) {
  197.             $title = " title='$title'";
  198.         }
  199.  
  200.         $alt = " alt='$name'";
  201.             
  202.         $target = $row->link_target;
  203.         if ('' != $target) {
  204.             $target = " target='$target'";
  205.         }
  206.         echo("<a href='$the_link'");
  207.         echo($rel . $title . $target);
  208.         echo('>');
  209.         if (($row->link_image != null) && $show_images) {
  210.             if (strstr($row->link_image, 'http'))
  211.                 echo "<img src='$row->link_image' $alt $title />";
  212.             else // If it's a relative path
  213.                 echo "<img src='" . get_settings('siteurl') . "$row->link_image' $alt $title />";
  214.         } else {
  215.             echo($name);
  216.         }
  217.         echo('</a>');
  218.         if ($show_updated && $row->recently_updated) {
  219.             echo get_settings('links_recently_updated_append');
  220.         }
  221.  
  222.         if ($show_description && ($desc != '')) {
  223.             echo($between.$desc);
  224.         }
  225.  
  226.         // now do the rating
  227.         if ($show_rating) {
  228.             
  229.             if (get_settings('links_rating_type') == 'number') {
  230.                 if (($row->link_rating != 0) || (get_settings('links_rating_ignore_zero') != 1)) {
  231.                     echo($between." $row->link_rating\n");
  232.                 }
  233.             } else if (get_settings('links_rating_type') == 'char') {
  234.                 echo($between);
  235.                 for ($r = $row->link_rating; $r > 0; $r--) {
  236.                     echo(get_settings('links_rating_char'));
  237.                 }
  238.             } else if (get_settings('links_rating_type') == 'image') {
  239.                 echo($between);
  240.                 if (get_settings('links_rating_single_image')) {
  241.                     for ($r = $row->link_rating; $r > 0; $r--) {
  242.                         echo(' <img src="'.get_settings('links_rating_image0').'" alt="' .
  243.                              $row->link_rating.'" />'."\n");
  244.                     }
  245.                 } else {
  246.                     if (($row->link_rating != 0) || (get_settings('links_rating_ignore_zero') != 1)) {
  247.                         $b = 'links_rating_image'.$row->link_rating;
  248.                         echo(' <img src="' .
  249.                              get_settings($b).'" alt="' .
  250.                              $row->link_rating.'" />'."\n");
  251.                     }
  252.                 }
  253.             } // end if image
  254.         } // end if show_rating
  255.         echo("$after\n");
  256.     } // end while
  257. }
  258.  
  259.  
  260. /** function get_linkobjectsbyname()
  261.  ** Gets an array of link objects associated with category 'cat_name'.
  262.  ** Parameters:
  263.  **   cat_name (default 'noname')  - The category name to use. If no
  264.  **     match is found uses all
  265.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  266.  **     'url', 'description', or 'rating'. Or maybe owner. If you start the
  267.  **     name with an underscore the order will be reversed.
  268.  **     You can also specify 'rand' as the order which will return links in a
  269.  **     random order.
  270.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  271.  **     are shown.
  272.  **
  273.  ** Use this like:
  274.  ** $links = get_linkobjectsbyname('fred');
  275.  ** foreach ($links as $link) {
  276.  **   echo '<li>'.stripslashes($link->link_name).'</li>';
  277.  ** }
  278.  **/
  279. function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
  280.     global $tablelinkcategories, $wpdb;
  281.     $cat_id = -1;
  282.     $results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
  283.     if ($results) {
  284.         foreach ($results as $result) {
  285.             $cat_id = $result->cat_id;
  286.         }
  287.     }
  288.     return get_linkobjects($cat_id, $orderby, $limit);
  289. }
  290.  
  291. /** function get_linkobjects()
  292.  ** Gets an array of link objects associated with category n.
  293.  ** Parameters:
  294.  **   category (default -1)  - The category to use. If no category supplied
  295.  **      uses all
  296.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  297.  **     'url', 'description', or 'rating'. Or maybe owner. If you start the
  298.  **     name with an underscore the order will be reversed.
  299.  **     You can also specify 'rand' as the order which will return links in a
  300.  **     random order.
  301.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  302.  **     are shown.
  303.  **
  304.  ** Use this like:
  305.  ** $links = get_linkobjects(1);
  306.  ** if ($links) {
  307.  **   foreach ($links as $link) {
  308.  **     echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
  309.  **   }
  310.  ** }
  311.  ** Fields are:
  312.  ** link_id
  313.  ** link_url
  314.  ** link_name
  315.  ** link_image
  316.  ** link_target
  317.  ** link_category
  318.  ** link_description
  319.  ** link_visible
  320.  ** link_owner
  321.  ** link_rating
  322.  ** link_updated
  323.  ** link_rel
  324.  ** link_notes
  325.  **/
  326. function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
  327.     global $tablelinks, $wpdb;
  328.  
  329.     $sql = "SELECT * FROM $tablelinks WHERE link_visible = 'Y'";
  330.     if ($category != -1) {
  331.         $sql .= " AND link_category = $category ";
  332.     }
  333.     if ($orderby == '')
  334.         $orderby = 'id';
  335.     if (substr($orderby,0,1) == '_') {
  336.         $direction = ' DESC';
  337.         $orderby = substr($orderby,1);
  338.     }
  339.     if (strcasecmp('rand',$orderby) == 0) {
  340.         $orderby = 'rand()';
  341.     } else {
  342.         $orderby = " link_" . $orderby;
  343.     }
  344.     $sql .= ' ORDER BY ' . $orderby;
  345.     $sql .= $direction;
  346.     /* The next 2 lines implement LIMIT TO processing */
  347.     if ($limit != -1)
  348.         $sql .= " LIMIT $limit";
  349.  
  350.     $results = $wpdb->get_results($sql);
  351.     if ($results) {
  352.         foreach ($results as $result) {
  353.             $result->link_url         = stripslashes($result->link_url);
  354.             $result->link_name        = stripslashes($result->link_name);
  355.             $result->link_description = stripslashes($result->link_description);
  356.             $result->link_notes       = stripslashes($result->link_notes);
  357.             $newresults[] = $result;
  358.         }
  359.     }
  360.     return $newresults;
  361. }
  362.  
  363. /** function get_linkrating()
  364.  ** Returns the appropriate html for the link rating based on the configuration.
  365.  ** Parameters:
  366.  **   link  - The link object returned from get_linkobjects
  367.  **/
  368. function get_linkrating($link) {
  369.     if (get_settings('links_rating_type') == 'number') {
  370.         if (($link->link_rating != 0) || (get_settings('links_rating_ignore_zero') != 1)) {
  371.             $s = "$link->link_rating";
  372.         }
  373.     } else if (get_settings('links_rating_type') == 'char') {
  374.         for ($r = $link->link_rating; $r > 0; $r--) {
  375.             $s .= get_settings('links_rating_char');
  376.         }
  377.     } else if (get_settings('links_rating_type') == 'image') {
  378.         if (get_settings('links_rating_single_image')) {
  379.             for ($r = $link->link_rating; $r > 0; $r--) {
  380.                 $s .= '<img src="'.get_settings('links_rating_image0').'" alt="' .
  381.                       $link->link_rating.'" />'."\n";
  382.             }
  383.         } else {
  384.             if (($link->link_rating != 0) || (get_settings('links_rating_ignore_zero') != 1)) {
  385.                 $b = 'links_rating_image'.$row->link_rating;
  386.                 $s = ' <img src="' .
  387.                      get_settings($b).'" alt="' .
  388.                      $link->link_rating.'" />'."\n";
  389.             }
  390.         }
  391.     } // end if image
  392.     return $s;
  393. }
  394.  
  395.  
  396. /** function get_linksbyname_withrating()
  397.  ** Gets the links associated with category 'cat_name' and display rating stars/chars.
  398.  ** Parameters:
  399.  **   cat_name (default 'noname')  - The category name to use. If no
  400.  **     match is found uses all
  401.  **   before (default '')  - the html to output before the link
  402.  **   after (default '<br />')  - the html to output after the link
  403.  **   between (default ' ')  - the html to output between the link/image
  404.  **     and it's description. Not used if no image or show_images == true
  405.  **   show_images (default true) - whether to show images (if defined).
  406.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  407.  **     'url' or 'description'. Or maybe owner. If you start the
  408.  **     name with an underscore the order will be reversed.
  409.  **     You can also specify 'rand' as the order which will return links in a
  410.  **     random order.
  411.  **   show_description (default true) - whether to show the description if
  412.  **     show_images=false/not defined
  413.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  414.  **     are shown.
  415.  **   show_updated (default 0) - whether to show last updated timestamp
  416.  */
  417. function get_linksbyname_withrating($cat_name = "noname", $before = '',
  418.                                     $after = '<br />', $between = " ",
  419.                                     $show_images = true, $orderby = 'id',
  420.                                     $show_description = true, $limit = -1, $show_updated = 0) {
  421.  
  422.     get_linksbyname($cat_name, $before, $after, $between, $show_images,
  423.                     $orderby, $show_description, true, $limit, $show_updated);
  424. }
  425.  
  426. /** function get_links_withrating()
  427.  ** Gets the links associated with category n and display rating stars/chars.
  428.  ** Parameters:
  429.  **   category (default -1)  - The category to use. If no category supplied
  430.  **      uses all
  431.  **   before (default '')  - the html to output before the link
  432.  **   after (default '<br />')  - the html to output after the link
  433.  **   between (default ' ')  - the html to output between the link/image
  434.  **     and it's description. Not used if no image or show_images == true
  435.  **   show_images (default true) - whether to show images (if defined).
  436.  **   orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
  437.  **     'url' or 'description'. Or maybe owner. If you start the
  438.  **     name with an underscore the order will be reversed.
  439.  **     You can also specify 'rand' as the order which will return links in a
  440.  **     random order.
  441.  **   show_description (default true) - whether to show the description if
  442.  **    show_images=false/not defined .
  443.  **   limit (default -1) - Limit to X entries. If not specified, all entries
  444.  **     are shown.
  445.  **   show_updated (default 0) - whether to show last updated timestamp
  446.  */
  447. function get_links_withrating($category = -1, $before = '', $after = '<br />',
  448.                               $between = " ", $show_images = true,
  449.                               $orderby = 'id', $show_description = true,
  450.                               $limit = -1, $show_updated = 0) {
  451.  
  452.     get_links($category, $before, $after, $between, $show_images, $orderby,
  453.               $show_description, true, $limit, $show_updated);
  454. }
  455.  
  456. /** function get_linkcatname()
  457.  ** Gets the name of category n.
  458.  ** Parameters: id (default 0)  - The category to get. If no category supplied
  459.  **                uses 0
  460.  */
  461. function get_linkcatname($id = 0) {
  462.     global $tablelinkcategories, $wpdb;
  463.     $cat_name = '';
  464.     if ('' != $id) {
  465.         $cat_name = $wpdb->get_var("SELECT cat_name FROM $tablelinkcategories WHERE cat_id=$id");
  466.     }
  467.     return stripslashes($cat_name);
  468. }
  469.  
  470. /** function get_get_autotoggle()
  471.  ** Gets the auto_toggle setting of category n.
  472.  ** Parameters: id (default 0)  - The category to get. If no category supplied
  473.  **                uses 0
  474.  */
  475. function get_autotoggle($id = 0) {
  476.     global $tablelinkcategories, $wpdb;
  477.     $auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $tablelinkcategories WHERE cat_id=$id");
  478.     if ('' == $auto_toggle)
  479.         $auto_toggle = 'N';
  480.     return $auto_toggle;
  481. }
  482.  
  483. /** function links_popup_script()
  484.  ** This function contributed by Fullo -- http://sprite.csr.unibo.it/fullo/
  485.  ** Show the link to the links popup and the number of links
  486.  ** Parameters:
  487.  **   text (default Links)  - the text of the link
  488.  **   width (default 400)  - the width of the popup window
  489.  **   height (default 400)  - the height of the popup window
  490.  **   file (default linkspopup.php) - the page to open in the popup window
  491.  **   count (default true) - the number of links in the db
  492.  */
  493. function links_popup_script($text = 'Links', $width=400, $height=400,
  494.                             $file='links.all.php', $count = true) {
  495.    global $tablelinks;
  496.    if ($count == true) {
  497.       $counts = $wpdb->get_var("SELECT count(*) FROM $tablelinks");
  498.    }
  499.  
  500.    $javascript = "<a href=\"#\" " .
  501.                  " onclick=\"javascript:window.open('$file?popup=1', '_blank', " .
  502.                  "'width=$width,height=$height,scrollbars=yes,status=no'); " .
  503.                  " return false\">";
  504.    $javascript .= $text;
  505.  
  506.    if ($count == true) {
  507.       $javascript .= " ($counts)";
  508.    }
  509.  
  510.    $javascript .="</a>\n\n";
  511.    echo $javascript;
  512. }
  513.  
  514.  
  515. /*
  516.  * function get_links_list()
  517.  *
  518.  * added by Dougal
  519.  *
  520.  * Output a list of all links, listed by category, using the
  521.  * settings in $tablelinkcategories and output it as a nested
  522.  * HTML unordered list.
  523.  *
  524.  * Parameters:
  525.  *   order (default 'name')  - Sort link categories by 'name' or 'id'
  526.  *   hide_if_empty (default true)  - Supress listing empty link categories
  527.  */
  528. function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
  529.     global $tablelinkcategories, $tablelinks, $wpdb;
  530.  
  531.     $order = strtolower($order);
  532.  
  533.     // Handle link category sorting
  534.     if (substr($order,0,1) == '_') {
  535.         $direction = ' DESC';
  536.         $order = substr($order,1);
  537.     }
  538.  
  539.     // if 'name' wasn't specified, assume 'id':
  540.     $cat_order = ('name' == $order) ? 'cat_name' : 'cat_id';
  541.  
  542.     if (!isset($direction)) $direction = '';
  543.     // Fetch the link category data as an array of hashesa
  544.     $cats = $wpdb->get_results("
  545.         SELECT DISTINCT link_category, cat_name, show_images, 
  546.             show_description, show_rating, show_updated, sort_order, 
  547.             sort_desc, list_limit
  548.         FROM `$tablelinks` 
  549.         LEFT JOIN `$tablelinkcategories` ON (link_category = cat_id)
  550.         WHERE link_visible =  'Y'
  551.             AND list_limit <> 0
  552.         ORDER BY $cat_order $direction ", ARRAY_A);
  553.  
  554.     // Display each category
  555.     if ($cats) {
  556.         foreach ($cats as $cat) {
  557.             // Handle each category.
  558.             // First, fix the sort_order info
  559.             $orderby = $cat['sort_order'];
  560.             $orderby = (bool_from_yn($cat['sort_desc'])?'_':'') . $orderby;
  561.  
  562.             // Display the category name
  563.             echo '    <li id="'.sanitize_title($cat['cat_name']).'">' . stripslashes($cat['cat_name']) . "\n\t<ul>\n";
  564.             // Call get_links() with all the appropriate params
  565.             get_links($cat['link_category'],
  566.                 '<li>',"</li>","\n",
  567.                 bool_from_yn($cat['show_images']),
  568.                 $orderby,
  569.                 bool_from_yn($cat['show_description']),
  570.                 bool_from_yn($cat['show_rating']),
  571.                 $cat['list_limit'],
  572.                 bool_from_yn($cat['show_updated']));
  573.  
  574.             // Close the last category
  575.             echo "\n\t</ul>\n</li>\n";
  576.         }
  577.     }
  578. }
  579.  
  580. ?>